package cn.com.miao.lynx.common.log.config;

import cn.com.miao.lynx.common.log.api.RemoteLogService;
import cn.com.miao.lynx.common.log.aspect.LogAspect;
import cn.com.miao.lynx.common.log.envnt.LogListener;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * LogAutoConfig
 *
 * @title: LogAutoConfig
 * @description:
 * @author: dengmiao
 * @create: 2019-12-27 12:58
 **/
@EnableAsync
@AllArgsConstructor
@ConditionalOnWebApplication
@Configuration
public class LogAutoConfig {

    private RemoteLogService remoteLogService;

    @Bean
    public LogListener logListener() {
        return new LogListener(remoteLogService);
    }

    @Bean
    public LogAspect logAspect() {
        return new LogAspect();
    }
}
